<template>
  <div class="home">
     <p>{{numb}}</p>
     <p>{{numa}}</p>
     <button @click="adda">a++</button>
     <button @click="addb">b++</button>
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState,mapMutations } from 'vuex';
export default {
  name: 'Home',
  components: {

  },
  computed:{
    // ...mapState(['a/num'])
    ...mapState({
      numb: state => state.b.num,
      numa: state => state.a.num
    })
  },
  methods: {
    // ...mapMutations(['add'])
    // ...mapMutations({
    //   adda: 'a/add',
    //   addb: 'b/add'
    // })
    ...mapMutations('a',{
      adda: 'add'
    }),
    ...mapMutations('b',{
      addb: 'add'
    })
  },
}
</script>
